Add directional wave features and release v1.1.0#15
Merged
Conversation
Implement distance-weighted directional wave features to capture spatial patterns in disease spread across neighboring locations. Features compute weighted averages of neighbor incidence in 8 directions (N, NE, E, SE, S, SW, W, NW) with support for temporal lags and velocity calculations. New modules: - src/idmodels/spatial_utils.py: Geographic utilities for distance, bearing, and directional neighbor calculations using Haversine formula - src/idmodels/data/: US state centroids with geographic coordinates Feature integration: - src/idmodels/preprocess.py: create_directional_wave_features() function with inverse distance weighting and configurable parameters - src/idmodels/gbqr.py: Integrated wave features into GBQR preprocessing pipeline with backwards compatibility Configuration: - pyproject.toml: Added examples dependencies (jupyter, matplotlib, plotly), fixed setuptools package discovery, and configured package data inclusion Testing: - 20 unit tests for spatial utilities - 14 unit tests for feature generation - 7 integration tests for GBQR pipeline - All tests passing Key features: - Configurable directions, temporal lags, and distance thresholds - Optional velocity features (rate of change) - Aggregate spatial feature (overall neighbor average) - Handles missing neighbors gracefully (NaN for locations without neighbors) - Efficient neighbor caching to avoid redundant distance calculations - Updated multicollinearity warning to clarify that opposite directions provide independent information in directional spread scenarios Disabled by default for backwards compatibility. Enable with use_directional_waves = True in model configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This release adds directional wave features for spatial-temporal disease modeling and removes optional example dependencies to streamline the package. Changes: - Bump version from 0.1.0 to 0.2.0 - Remove optional "examples" dependencies (jupyter, matplotlib, plotly) - Update CHANGELOG.md with comprehensive 0.2.0 release notes - Regenerate uv.lock with updated dependencies 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Auto-fix 449 linting errors including: - Quote style standardization (single to double quotes) - Import statement sorting and formatting - Remove unused imports All checks now pass with ruff v0.14.0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
… Also, modified pre-commit-config.
matthewcornell
previously approved these changes
Dec 8, 2025
Member
matthewcornell
left a comment
There was a problem hiding this comment.
After a quick-ish scan, this looks good. Excited to see how models using this perform!
Documents the NSSP data source support added in PR #14, including: - NSSP data source support for SARIX and GBQR models - HSA and state-level forecasting - Breaking change: locations replaced by states/hsas config Also adds codespell config to ignore "HSA" acronym. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
matthewcornell
approved these changes
Dec 8, 2025
lshandross
approved these changes
Dec 8, 2025
Contributor
lshandross
left a comment
There was a problem hiding this comment.
Had a couple of questions but unless any of them stand out as something to be addressed, I don't want to slow down the development process and getting this merged in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds directional wave features to the GBQR model for capturing spatial-temporal patterns in disease spread, and releases version
0.2.01.1.0 of the package.Key Features
Directional Wave Features:
Spatial Utilities:
spatial_utils.pymodule with haversine distance and bearing calculationsstate_centroids.csv) from US Census Bureau TIGER/Line ShapefilesConfiguration Example:
Files Added
Core Implementation:
src/idmodels/spatial_utils.py- Spatial utilities with distance/bearing calculationssrc/idmodels/data/state_centroids.csv- Geographic coordinates for 50 states + DC + PRsrc/idmodels/data/README.md- Data source documentationTests:
tests/unit/test_spatial_utils.py- 20 unit tests for spatial utilitiestests/unit/test_directional_wave_features.py- 14 unit tests for feature generationtests/integration/test_gbqr_wave_features.py- 7 integration tests for GBQR pipelineDocumentation:
docs/directional_wave_features.md- Comprehensive user guide with examplesFiles Modified
src/idmodels/preprocess.py- Addedcreate_directional_wave_features()functionsrc/idmodels/gbqr.py- Integrated wave features into preprocessing pipelinepyproject.toml- Updated package data inclusionsrc/idmodels/__init__.py- Bumped version to 0.2.0CHANGELOG.md- Added v0.2.0 release notesData Source & Transparency
The state centroids are now bundled as a CSV file rather than hardcoded, providing:
Data Accuracy: ~10 meters (4 decimal places), suitable for state-level spatial analysis
Test Results
✅ 45 tests pass including all new directional wave feature tests
❌ 3 pre-existing failures in SARIX Fourier tests (unrelated to this PR)
Backwards Compatibility
✅ Fully backwards compatible
use_directional_waves = False)Version
Bumped from 0.1.0 →
0.2.01.1.0Documentation
See
docs/directional_wave_features.mdfor:Quick Start
Enable with default settings:
Customize for 4 cardinal directions only:
Future Enhancements
Potential extensions (not in this PR):
🤖 Generated with Claude Code